﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LinqProviders.LinqToNaver
{
    public static class NaverQuerytypeFactory
    {

        /// <summary>
        /// Creates the specified element type.
        /// </summary>
        /// <param name="elementType">Type of the element.</param>
        /// <returns></returns>
        public static NaverSearchResult Create(Type elementType)
        {
            NaverSearchResult resultType = null;

                if (elementType == typeof(RankSearchResult))
                {
                    resultType = new RankSearchResult();
                }
                else if (elementType == typeof(PageSearchResult))
                {
                    resultType = new PageSearchResult();
                }
                else if (elementType == typeof(ImageSearchResult))
                {
                    resultType = new ImageSearchResult();
                }
                else if (elementType == typeof(NewsSearchResult))
                {
                    resultType = new NewsSearchResult();
                }
                else if (elementType == typeof(BlogSearchResult))
                {
                    resultType = new BlogSearchResult();
                }
                else if (elementType == typeof(RecmdSearchResult))
                {
                    resultType = new RecmdSearchResult();
                }
                else if (elementType == typeof(WebkrSearchResult))
                {
                    resultType = new WebkrSearchResult();
                }
                else if (elementType == typeof(KinSearchResult))
                {
                    resultType = new KinSearchResult();
                }
                else if (elementType == typeof(DocSearchResult))
                {
                    resultType = new DocSearchResult();
                }
                else if (elementType == typeof(ShopSearchResult))
                {
                    resultType = new ShopSearchResult();
                }
                else if (elementType == typeof(EncycSearchResult))
                {
                    resultType = new EncycSearchResult();
                }
                else if (elementType == typeof(ErrataSearchResult))
                {
                    resultType = new ErrataSearchResult();
                }
                else if (elementType == typeof(CafeSearchResult))
                {
                    resultType = new CafeSearchResult();
                }
                else
                {
                    throw new InvalidOperationException("일치하는 Query ResultType이 존재하지 않아 객체 생성에 실패 하였습니다.");
                }

            return resultType;
        }
    }
}
